Add tests for running from command line#492
Open
robinborst95 wants to merge 1 commit intomainmatter:masterfrom
Open
Add tests for running from command line#492robinborst95 wants to merge 1 commit intomainmatter:masterfrom
robinborst95 wants to merge 1 commit intomainmatter:masterfrom
Conversation
robinborst95
commented
Apr 4, 2022
| @@ -0,0 +1,3 @@ | |||
| { | |||
| "name": "missing-translations" | |||
Contributor
Author
There was a problem hiding this comment.
When running the bin/cli script from a fixture, the let rootDir = pkgDir.sync(); line would return the root of this whole repo, because there is no package.json in fixtures. Adding it with just a name fixed this.
| "eslint-config-prettier": "8.5.0", | ||
| "eslint-plugin-node": "11.1.0", | ||
| "eslint-plugin-prettier": "4.0.0", | ||
| "execa": "^5.0.0", |
Contributor
Author
There was a problem hiding this comment.
This dependency actually came with Jest already, hence no changes in yarn.lock. Also note that version 6.x doesn't work here, because of the same reason that requireing it doesn't work then.
| afterEach(async function () { | ||
| await execa('git', ['checkout', 'HEAD', 'fixtures/remove-unused-translations/translations'], { | ||
| cwd: __dirname, | ||
| }); |
Contributor
Author
There was a problem hiding this comment.
The auto-fix option actually changes the files, so this makes sure those changes are undone. It does feel a bit specific though, so any other ideas are welcome :)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After the
pkg-dirupgrade in #427 thebin/clicommand failed, but this was not caught because there were no tests for it, so I added that with this PR.About the tests themselves: I'm not 100% sure if this is the way to go, but these are at least simple tests that showed that the command was broken before the downgrade fixed it. I'm happy to get any feedback on how to improve this.